package world.hezi.handlers;

import kotlin.coroutines.CoroutineContext;
import net.mamoe.mirai.contact.Contact;
import net.mamoe.mirai.event.EventHandler;
import net.mamoe.mirai.event.ListeningStatus;
import net.mamoe.mirai.event.SimpleListenerHost;
import net.mamoe.mirai.event.events.MessageEvent;
import net.mamoe.mirai.message.data.At;
import net.mamoe.mirai.message.data.MessageChain;
import net.mamoe.mirai.message.data.MessageChainBuilder;
import net.mamoe.mirai.message.data.QuoteReply;
import org.jetbrains.annotations.NotNull;
import world.hezi.bot.BeatsaverBot;
import world.hezi.utils.PicturesUtil;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;


public class HelpEventHandlers extends SimpleListenerHost {
    Map<Long, Set<String>> map = BeatsaverBot.CONCERN;
    Set<String> set = BeatsaverBot.CHINA;
    @Override
    public void handleException(@NotNull CoroutineContext context, @NotNull Throwable exception){
    }
    @NotNull
    @EventHandler
    public ListeningStatus onMessage(@NotNull MessageEvent event) throws Exception {
        String message = event.getMessage().contentToString();
        message = message.replaceAll("！","!");
        int type = PicturesUtil.getType(message);
        Contact contact = event.getSubject();
        if (type==10000){
            contact.sendMessage(Objects.requireNonNull(PicturesUtil.getHelpImg(contact)));
        }
        return ListeningStatus.LISTENING;
    }
}